$(document).ready(function() {
$(window).on('focus', function(event) {
$('.show-focus-status > .alert-danger').addClass('hidden');
$('.show-focus-status > .alert-success').removeClass('hidden');
}).on('blur', function(event) {
$('.show-focus-status > .alert-success').addClass('hidden');
$('.show-focus-status > .alert-danger').removeClass('hidden');
});
$('.date-picker').each(function () {
var $datepicker = $(this),
cur_date = ($datepicker.data('date') ? moment($datepicker.data('date'), "YYYY/MM/DD") : moment()),
format = {
"weekday" : ($datepicker.find('.weekday').data('format') ? $datepicker.find('.weekday').data('format') : "dddd"),
"date" : ($datepicker.find('.date').data('format') ? $datepicker.find('.date').data('format') : "MMMM Do"),
"year" : ($datepicker.find('.year').data('year') ? $datepicker.find('.weekday').data('format') : "YYYY")
};
function updateDisplay(cur_date) {
$datepicker.find('.date-container > .weekday').text(cur_date.format(format.weekday));
$datepicker.find('.date-container > .date').text(cur_date.format(format.date));
$datepicker.find('.date-container > .year').text(cur_date.format(format.year));
$datepicker.data('date', cur_date.format('YYYY/MM/DD'));
$datepicker.find('.input-datepicker').removeClass('show-input');
}
updateDisplay(cur_date);
$datepicker.on('click', '[data-toggle="calendar"]', function(event) {
event.preventDefault();
$datepicker.find('.input-datepicker').toggleClass('show-input');
});
$datepicker.on('click', '.input-datepicker > .input-group-btn > button', function(event) {
event.preventDefault();
var $input = $(this).closest('.input-datepicker').find('input'),